package org.adw.launcher2.ld.secret.ui.utils;

import org.adw.launcher2.ld.secret.db.DatabaseHelper;

import android.app.Application;
import android.content.ContentResolver;

/*
 * Define constants and global variable aaaaa
 */
public class Global extends Application {
	public static int test;
	public static DatabaseHelper dbHelper;
	public static ContentResolver cr;
	public static String createUserTable = "CREATE TABLE IF NOT EXISTS user" +
	"(id  INTEGER PRIMARY KEY  AUTOINCREMENT  NOT NULL  UNIQUE ,"+
	" image BLOB, name TEXT,"+ "note TEXT, nickname TEXT);";
	
	public static String createPhoneTable = "CREATE TABLE IF NOT EXISTS " +
	"phone (id INTEGER, type INTEGER, value TEXT," +
	"FOREIGN KEY(id) REFERENCES user(id) ON DELETE CASCADE);";
	
	public static String createEmailTable = "CREATE TABLE IF NOT EXISTS " +
			"email (id INTEGER, type INTEGER,value TEXT," +
			"FOREIGN KEY(id) REFERENCES user(id) ON DELETE CASCADE);";
	
	public static String createPostalAddressTable = "CREATE TABLE IF NOT EXISTS postal_address " +
	"(id INTEGER, type INTEGER, street TEXT, poBox TEXT, neighborhood TEXT, city TEXT, state TEXT, zipcode TEXT,"+ 
	"country TEXT,FOREIGN KEY(id) REFERENCES user(id) ON DELETE CASCADE);";
	
	public static String createOrgTable = "CREATE TABLE IF NOT EXISTS organization(id INTEGER, type INTEGER, company TEXT, title TEXT," +
	"FOREIGN KEY(id) REFERENCES user(id) ON DELETE CASCADE);";
	
	public static String createIMTable = "CREATE TABLE IF NOT EXISTS " +
			"im (id INTEGER, type TEXT, value TEXT," +
			"FOREIGN KEY(id) REFERENCES user(id) ON DELETE CASCADE);";
	
	public static String createWebsiteTable = "CREATE TABLE IF NOT EXISTS website " +
			"(id INTEGER, value TEXT," +
			"FOREIGN KEY(id) REFERENCES user(id) ON DELETE CASCADE);";
	
	public static String enableForeignKey = "PRAGMA foreign_keys=ON;";
	
	public static String insertIntoUser = "INSERT INTO user(id,image,name,note,nickname)" +
			"VALUES(?,?,?,?,?) ";
	
	public static String insertIntoPhone = "INSERT INTO phone(id,type,value) VALUES(?,?,?)";
	
	public static String insertIntoEmail = "INSERT INTO email(id,type,value)" +
	"VALUES(?,?,?) ";
	
	public static String insertIntoPA = "INSERT INTO postal_address(id,type,street,poBox,neighborhood," +
			"city,state,zipcode,country) VALUES(?,?,?,?,?,?,?,?,?) ";
	

	public static String insertIntoOrg = "INSERT INTO organization(id,type,company,title)" +
			"VALUES(?,?,?,?)";
	
	public static String insertIntoIM = "INSERT INTO im(id,type,value) VALUES(?,?,?)";
	
	public static String insertIntoWebsite = "INSERT INTO website(id,value) VALUES(?,?)";
}
